# 数据采集    绕过登录     进入页面
import urllib.request
import urllib.parse
import urllib.error

url="https://weibo.cn/7820099377/info"

headers = {
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
# 带数据的cookie
'Cookie':'_T_WM=5f84d36135b980144e0398a3e1c970b8; SCF=AlsMw61SqdUBa6XEnihW-fzrilZ4xcTNpImGUghdNEFdTs4LRxYRRkGqlPpcuam7vmQUXddrzhqnuYVhc7NF9N0.; SUB=_2A25LfTy7DeRhGeFG6VIR-SfPzDuIHXVo8zBzrDV6PUJbktAbLU_QkW1Nfgud0Zehb5G5RYpXI2EQI32AnburdbfN; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WW9xsjc9e_3q8F-A9SECuZT5NHD95QN1hz7eh.4e0MNWs4Dqcj_i--ciK.4iKLWi--4i-20iKy8i--Xi-zRiKy8i--ciK.RiKLsi--4iKnNiKy8; SSOLoginState=1719225579; ALF=1721817579',
# Referer判断是否从上一个页面进入   用作图片防盗链
"Referer":"https://weibo.cn/"

}

request=urllib.request.Request(url=url,headers=headers)
response=urllib.request.urlopen(request)
content=response.read().decode('utf-8')

print(content)
with open('web.html','w',encoding="utf-8") as f:
    f.write(content)